// js实现语音转文字通常需要借助Web Speech API

const recognition = new SpeechRecognition()
recognition.continuous = true //是否持续监听
recognition.lang = 'zh-CN'
recognition.interimResults = true //是否返回中间结果
recognition.start()
let content = document.querySelector('.content')
recognition.onresult = function(event) {
	let result = ''
	for (let i = event.resultIndex; i < event.results.length; i++) {
		result += event.results[i][0].transcript
	}
	content.innerHTML = result
	console.log(result);
}